package com.framework.bdf4j.socket.server;

import java.util.logging.Logger;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class MyServerHandler extends SimpleChannelInboundHandler<String> {
 


    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, String requestContent) throws Exception {
		System.out.println("请求数据："+ requestContent);
		
		channelHandlerContext.writeAndFlush(requestContent); 
//		System.out.println("响应数据："+ response);
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
        ctx.flush();
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        ctx.writeAndFlush(cause);
        ctx.close();
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
		
    }
}
